/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.avu.tp.assign2.question3.srp.vialoted;

/**
 *
 * @author Malotana
 */
public class TransactionImpl implements Transactions{
    private String name;
    private String surname;
    private int accountNumber;
    private double balance;
    private double amount;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSurname() {
        return surname;
    }

    public void setSurname(String surname) {
        this.surname = surname;
    }

    public int getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(int accountNumber) {
        this.accountNumber = accountNumber;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }
    
    @Override
    public void statement() {
        System.out.printf(" Holder's Details:     %s %s\n", getName(), getSurname());
        System.out.printf(" Balance: R%.2f\n", getBalance());
    }

    @Override
    public void deposit() {
        System.out.printf(" Holder's Details:     %s %s\n", getName(), getSurname());
        System.out.printf(" Your balance is R%.2f\n", getBalance());
        
        amount = cashDeposit();
        
        while (amount <= 0 )
        {
            System.out.printf(" Are u a fool? Enter amount more than R0 \n");
            
            amount = cashDeposit();
        }
        
        balanceAdding();
        
        System.out.printf(" New balance is R%.2f\n", getBalance());
    }
    
    public double cashDeposit()
    {
        amount = 50;
        
        return amount; 
    }
    
    public void balanceAdding()
    {
        double bal = getBalance() + amount;
        
        setBalance(bal);
    }
    
    @Override
    public void withdrawal() {
        System.out.printf(" Holder's Details:     %s %s\n", getName(), getSurname());
        System.out.printf(" Your current balance is R%.2f\n", getBalance());

        
        amount = withDrawCash();
        
        subtractAmount();
    }
    
    public double withDrawCash() {
        amount =100;
        
        return amount;
    }

    public void subtractAmount() {
        
        double newBalance = getBalance() - amount;
        
        setBalance(newBalance);
        
    }

    @Override
    public void transaction() {
        statement();
        deposit();
        withdrawal();
   }
}